﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using ws_sismun.Models;
using ws_sismun.Services;
namespace ws_sismun.Controllers
{
    public class VecinoController : ApiController
    {

        private VecinoRepository vecinoReposiroty;

        public VecinoController()
        {
            this.vecinoReposiroty = new VecinoRepository();
        }

        [HttpGet]
        [ActionName("search")]
        public ServiceResponseModel GetVecinosBy( string DocumentType, string DocumentNumber, 
                                                  string Fullname, string Sector, string SubSector )
        {

            ServiceResponseModel response = new ServiceResponseModel();

            try 
            {
                response.ResponseCode = "200";
                response.ResponseMessage = "Success";
                response.ResponseBody = vecinoReposiroty.GetAllVecinos( DocumentType, DocumentNumber, Fullname, Sector, SubSector );
                
            }
            catch( Exception ){
                response.ResponseCode = "999";
                response.ResponseMessage = "Ocurrio un problema al momento de solicitar la información";
            }


            return response;
        }

    }
}
    